import beforeRouteEnter from './interceptor/beforeRouteEnter';
import afterRouteEnter from './interceptor/afterRouteEnter';

// 需要加拦截器的方法
const routeJumpMethods = [
    'navigateTo',
    'redirectTo',
    'switchTab',
    'reLaunch',
    'navigateBack',
];
// 加入拦截器
routeJumpMethods.forEach(method => {
    uni.addInterceptor(method, {
        // 路由前跳转拦截器
        invoke: beforeRouteEnter,
        // 路由跳转成功后拦截器
        success: afterRouteEnter,
    });
});